package com.example.combwyaq.visualinterface.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import com.example.combwyaq.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class IDLogFragment extends Fragment {


    private TextView goPohone;
    private EditText usernumId;
    private EditText userpwdId;
    private Button logBut;

    public IDLogFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View inflate = inflater.inflate(R.layout.fragment_idlog, container, false);
        goPohone = (TextView) inflate.findViewById(R.id.go_pohone);
        usernumId = (EditText) inflate.findViewById(R.id.usernum_id);
        userpwdId = (EditText) inflate.findViewById(R.id.userpwd_id);
        logBut = (Button) inflate.findViewById(R.id.log_but);
        goPohone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setAction("200");
                getActivity().sendBroadcast(intent);
            }
        });
        logBut.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.putExtra("username",usernumId.getText().toString());
                intent.putExtra("password",userpwdId.getText().toString());
                intent.setAction("idlog");
                getActivity().sendBroadcast(intent);
            }
        });

        return inflate;
    }

    private void initView() {


    }
}
